import request from '@/utils/request'

/**
 * @description 查询业务分类下拉数据
 * @returns {AxiosPromise}
 */
const queryBusiness = () => {
  return request({
    url:'/system/dict/data/type/evaluate_quest_business',
    method:'get'
  })
}
/**
 * @description 周期字典查询
 * @returns {AxiosPromise}
 */
const queryCycle = () => {
  return request({
    url:'/system/dict/data/type/evaluate_quest_cycle',
    method:'get',
    params:{}
  })
}
/**
 * @description {问题/风险类型}
 * @returns {*}
 */
const queryDangeType = () => {
  return request({
    url:'/system/dict/data/type/evaluate_risk_type',
    method:'get',
  })
}
/**
 * @description 和新政策查询
 * @returns {AxiosPromise}
 */
const corePolicies = () => {
  return request({
    url:'/zhpg/quest/queryHxzcList',
    method:'get'
  })
}
/**
 * @description 查询专家数据
 * @returns {AxiosPromise}
 */
const queryExpertList = () => {
  return request({
    url:'/zhpg/quest/queryZjList',
    method:'post',
    data:{}
  })
}
/**
 * @description 上传接口
 * @param data {FormData}
 * @returns {AxiosPromise}
 */
const uploadFileInter = (data) => {
  return request({
    url:'/zhpg/template/upload',
    method:'post',
    headers: {
      "Content-Type": "multipart/form-data",
    },
    data
  })
}
/**
 * @description 下载
 * @param attachmentId {下载id}
 */
const downLoadInter = (attachmentId) => {
  return request({
    url:`/zhpg/template/download/${attachmentId}`,
    method:'get',
    responseType: 'blob'
    // params:{
    //   attachmentId
    // }
  })
}
/**
 * @description 删除上传文件
 * @param id {文件id}
 * @returns {AxiosPromise}
 */
const delFile = (id) => {
  return request({
    url:'/zhpg/template/deleteTemplate',
    method:'get',
    params:{
      id
    }
  })
}
/**
 * @description 新增任务
 * @param data {{zhpgEvaluateIndexList: [], evaluateQuestCycle: string, zhpgEvaluateTemplateList: [], evaluateExpertIds: [], evaluateQuestStatus: string, evaluateQuestBusiness: string, zhpgEvaluateExpertList: [], evaluateQuestTriggerMonth: string, evaluateQuestTitle: string, evaluateQuestContent: string, evaluateQuestCorePolicy: string, evaluateQuestTriggerHours: string}}
 * @returns {AxiosPromise}
 */
const addTask = (data) => {
  return request({
    url:'/zhpg/quest/instrQuest',
    method:'post',
    data
  })
}
/**
 * @description 修改任务
 * @param data
 * @returns {AxiosPromise}
 */
const upDateTask = (data) => {
  return request({
    url:'/zhpg/quest/updateQuest',
    method:'post',
    data
  })
}
/**
 * @description 评估任务组长查询
 * @param params {请求参数}
 * @returns {AxiosPromise}
 */
const queryLeaderData = (data) => {
  return request({
    url:'/zhpg/history/queryZzPageList',
    method:'post',
    data
  })
}
/**
 * @description 评估任务专家查询
 * @returns {AxiosPromise}
 * @param {请求参数}
 */
const queryExpertData = (data) => {
  return request({
    url:'/zhpg/history/queryZjPageList',
    method:'post',
    data
  })
}
/**
 * @description {通过主键查询评估任务详情接口}
 * @param id {请求参数}
 * @returns {AxiosPromise}
 */
const queryDetailQuest = (id) => {
  return request({
    url:'/zhpg/quest/queryDetailQuest',
    method:'post',
    data:{
      id
    }
  })
}
/**
 * @description {评估任务-新增问题-风险}
 * @param data {{evaluateRiskName: string, evaluateRiskType: string, evaluateRiskContent: string, evaluateRiskZjjy: string}}
 * @returns {AxiosPromise}
 */
const addDange = (data) => {
  return request({
    url:'/zhpg/risk/instrRisk',
    method:'post',
    data
  })
}
/**
 * @description {查询状态的}
 * @returns {AxiosPromise}
 */
const queryState = () => {
  return request({
    url:'/system/dict/data/type/evaluate_quest_state',
    method:'get',
  })
}
/**
 * @description {评估任务管理,分页查询}
 * @param data {{pageSize: number, pageNum: number}}
 * @returns {AxiosPromise}
 */
const assessmentTaskManagement = (data) => {
  return request({
    url:'/zhpg/quest/queryRwglPageList',
    method:'post',
    data
  })
}
/**
 * @description {评估任务管理详情接口}
 * @param id {详情id}
 * @returns {AxiosPromise}
 */
const taskDetail = (id) => {
  return request({
    url:'/zhpg/quest/queryDetailQuest',
    method:'post',
    data:{
      id
    }
  })
}
/**
 * @description {开始执行任务}
 * @param id {任务id}
 * @returns {AxiosPromise}
 */
const startQuest = (id) => {
  return request({
    url:'/zhpg/quest/startQuest',
    method:'get',
    params:{
      id
    }
  })
}
/**
 * @description {暂停执行任务}
 * @param id {任务id}
 * @returns {AxiosPromise}
 */
const stopQuest = (id) => {
  return request({
    url:'/zhpg/quest/stopQuest',
    method:'get',
    params:{
      id
    }
  })
}
/**
 * @description {评估历史任务列表查询}
 * @param params {{evaluateQuestCycle: string, orderBySort: string, evaluateQuestBusiness: string, evaluateQuestTitle: string, pageSize: number, params: {beginTime: string, endTime: string}, pageNum: number}}
 * @returns {AxiosPromise}
 */
const queryHistory = (params) => {
  return request({
    url:'/zhpg/history/list',
    method:'post',
    data:params
  })
}
/**
 * @description {历史评分记录-评分记录详情接口}
 * @param id {详情id}
 * @returns {AxiosPromise}
 */
const queryHistoryDetail = (id) => {
  return request({
    url:'/zhpg/history/queryDetailHistoryRateRecord',
    method:'get',
    params:{
      id
    }
  })
}
/**
 * @description {历史评分记录-评分记录详情0-分页接口}
 * @returns {*}
 * @param data
 */
const queryHistoryDetail2 = (data) => {
  return request({
    url:'/zhpg/history/queryPfjlxqPageList',
    method:'post',
    data
  })
}
/**
 * @description {查询评估时的问题}
 * @param data {{pageSize: number, pageNum: number}}
 * @returns {*}
 */
const questionPageList = (data) => {
  return request({
    url:'/zhpg/risk/queryWtFxPageList',
    method:'post',
    data
  })
}
/**
 * @description {导出}
 * @param data {{pageSize: number, pageNum: number}}
 * @returns {*}
 */
const questTionExport = (data) => {
  return request({
    url:'/zhpg/risk/export',
    method:'post',
    data
  })
}
/**
 * @description {}
 * @returns {*}
 */
const riskType = () => {
  return request({
    url:'/system/dict/data/type/evaluate_risk_type',
    method:'get'
  })
}
/**
 * @description 评估任务-组长内部-分页查询
 * @param data
 * @returns {AxiosPromise}
 */
const leaderPageList = (data) => {
  return request({
    url:'/zhpg/expert/queryZznbPageList',
    method:'post',
    data
  })
}
/**
 * @description 评估任务-专家内部-分页查询
 * @param data
 * @returns {AxiosPromise}
 */
const expertPageList = (data) => {
  return request({
    url:'/zhpg/expert/queryZjnbPageList',
    method:'post',
    data
  })
}
/**
 * @description {评估问题-风险-批量删除接口}
 * @param ids {*[]}
 * @returns {AxiosPromise}
 */
const delQuestion = (ids) => {
  return request({
    url:'/zhpg/risk/delByIds',
    method:'delete',
    data:{
      ids
    }
  })
}
/**
 * @description {删除评估任务}
 * @param id {删除id}
 * @returns {AxiosPromise}
 */
const deleteQuest = (id) => {
  return request({
    url:'/zhpg/quest/deleteQuest',
    method:'get',
    params:{
      id
    }
  })
}
/**
 * @description {评估任务-组长内部-提交接口}
 * @param data {请求参数}
 * @returns {*}
 */
const zzCommit = (data) => {
  return request({
    url:'/zhpg/expert/sub/evaluateZzSubmitAdd',
    method:'post',
    data
  })
}
/**
 * @description {评估任务-专家内部-提交接口}
 * @param data {请求参数}
 * @returns {*}
 */
const zjCommit = (data) => {
  return request({
    url:'/zhpg/expert/sub/evaluateSubmitAdd',
    method:'post',
    data
  })
}
const getTree = () => {
  return request({
    url:'/zhpg/index/selectSjfxzxtIndex',
    method:'get',
  })
}
export {
  zzCommit,
  zjCommit,
  queryBusiness,
  queryExpertList,
  uploadFileInter,
  downLoadInter,
  delFile,
  queryCycle,
  addTask,
  upDateTask,
  corePolicies,
  queryLeaderData,
  queryExpertData,
  queryDetailQuest,
  addDange,
  queryState,
  assessmentTaskManagement,
  taskDetail,
  startQuest,
  stopQuest,
  queryHistory,
  queryHistoryDetail,
  queryHistoryDetail2,
  questionPageList,
  riskType,
  leaderPageList,
  expertPageList,
  delQuestion,
  deleteQuest,
  questTionExport,
  getTree
}
